package com.buaa.airticketbookingsystem.Service.UserServiceImpl;

import com.buaa.airticketbookingsystem.Dao.UserDao;
import com.buaa.airticketbookingsystem.Entity.User;
import com.buaa.airticketbookingsystem.Service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class UserServiceImpl implements UserService {
    @Autowired
    private UserDao userDao;

    @Override
    public User selectUserByEmail(String email) {
        return userDao.selectUserByEmail(email);
    }

    @Override
    public void registerNewUser(User user) {
        userDao.registerNewUser(user);
    }

    @Override
    public void changeUserPassword(String email, String newPassword) {
        userDao.changeUserPassword(email, newPassword);
    }

    @Override
    public void charge(String email, double charge){
        userDao.charge(email, charge);
    }

    @Override
    public void logout(String email){ userDao.logout(email); }

    @Override
    public void login(String email){
        userDao.login(email);
    }

    @Override
    public void refund(long time, String email){
        userDao.refund(time/1000, email);
    }

    @Override
    public void lowCredit(String email){
        userDao.lowCredit(email);
    }

    @Override
    public void highCredit(String email){
        userDao.highCredit(email);
    }
}
